package com.xiehua.task.persistence;

import com.xiehua.task.job.pool.Job;

import java.time.LocalDateTime;

/***
 * 任务持久化
 * */
public interface TaskPersistence {

    /***
     * 持久化一个任务
     * **/
    void persistence(Job job) throws Exception;

    /**
     * 根据id查询一个job
     * **/
    Job queryJob(String taskId) throws Exception;

    /***
     * 分页查询job
     * */
    Job.JobPage queryJob(Job.Query query);

    /**
     * 查询成功的job数量
     * **/
    Integer countSuccessJob(LocalDateTime start,LocalDateTime end,String topic);

    /**
     * 查询失败的job数量
     * **/
    Integer countfailJob(LocalDateTime start,LocalDateTime end,String topic);

    /**
     * 资源释放
     * **/
    void close();

}
